/*     */ package com.qmsk.business.keyword.keyWordReply.service;
/*     */ 
/*     */ import com.qmsk.business.keyword.keyWordReply.dao.KeyWordReplyDAO;
/*     */ import com.utils.basic.CDateTimeComm;
/*     */ import com.utils.basic.MapUtils;
/*     */ import com.utils.basic.ObjectComm;
/*     */ import com.utils.gson.in.GsonHeadManyRows;
/*     */ import com.utils.gson.in.GsonHeadOneRow;
/*     */ import com.utils.gson.in.ParserDataSetJson;
/*     */ import com.utils.web.RequestUtils;
/*     */ import java.sql.SQLException;
/*     */ import java.util.ArrayList;
/*     */ import java.util.Date;
/*     */ import java.util.HashMap;
/*     */ import java.util.LinkedHashMap;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import org.springframework.beans.factory.annotation.Autowired;
/*     */ import org.springframework.stereotype.Service;
/*     */ import org.springframework.transaction.annotation.Propagation;
/*     */ import org.springframework.transaction.annotation.Transactional;
/*     */ 
/*     */ @Service
/*     */ public class KeyWordReplyService
/*     */ {
/*     */ 
/*     */   @Autowired
/*     */   private KeyWordReplyDAO dao;
/*     */ 
/*     */   @Transactional(propagation=Propagation.NOT_SUPPORTED, readOnly=true)
/*     */   public List<Object> getCsvDown(HttpServletRequest request)
/*     */     throws Exception
/*     */   {
/*  37 */     Map params = new HashMap();
/*     */ 
/*  39 */     MapUtils.addPercentToMap(params, "name", 
/*  40 */       RequestUtils.getString(request, "name"));
/*     */ 
/*  42 */     GsonHeadManyRows g = this.dao.getAllShop(params);
/*     */ 
/*  44 */     if (g == null) {
/*  45 */       return null;
/*     */     }
/*  47 */     List result = new ArrayList();
/*     */ 
/*  49 */     LinkedHashMap map = new LinkedHashMap();
/*  50 */     map.put("1", "品牌图");
/*  51 */     map.put("2", "店铺编码");
/*  52 */     map.put("3", "店铺名称");
/*  53 */     map.put("4", "电话");
/*  54 */     map.put("5", "手机");
/*  55 */     map.put("6", "地址");
/*  56 */     map.put("7", "加入时间");
/*  57 */     map.put("8", "状态");
/*     */ 
/*  59 */     result.add(map);
/*     */ 
/*  61 */     List exportData = new ArrayList();
/*     */ 
/*  63 */     for (int i = 0; i < g.getDataLength(); ++i) {
/*  64 */       Map row = new LinkedHashMap();
/*  65 */       String imgURL = (String)g.getValueOfName("imgURL", i);
/*  66 */       String code = (String)g.getValueOfName("code", i);
/*  67 */       String sName = (String)g.getValueOfName("sName", i);
/*  68 */       String mp = (String)g.getValueOfName("mp", i);
/*  69 */       String tel = (String)g.getValueOfName("tel", i);
/*  70 */       String addr = 
/*  71 */         ObjectComm.objectToString(g.getValueOfName("addr", i));
/*  72 */       Date createTime = (Date)g.getValueOfName("createTime", i);
/*  73 */       String Email = ObjectComm.objectToString(g.getValueOfName("Email", 
/*  74 */         i));
/*     */ 
/*  76 */       row.put("1", (imgURL == null) ? " " : imgURL);
/*  77 */       row.put("2", (code == null) ? " " : code);
/*  78 */       row.put("3", (sName == null) ? " " : sName);
/*  79 */       row.put("4", (mp == null) ? " " : mp);
/*  80 */       row.put("5", (tel == null) ? " " : tel);
/*  81 */       row.put("6", (addr == null) ? " " : addr);
/*  82 */       row.put("7", 
/*  83 */         (createTime == null) ? " " : 
/*  84 */         CDateTimeComm.dateToyyyyMMddHHmmss(createTime));
/*  85 */       row.put("8", (Email == null) ? " " : Email);
/*     */ 
/*  87 */       exportData.add(row);
/*     */     }
/*  89 */     result.add(exportData);
/*     */ 
/*  91 */     return result;
/*     */   }
/*     */ 
/*     */   @Transactional(rollbackFor={Exception.class})
/*     */   public Long insertInfor(ParserDataSetJson pData)
/*     */     throws Exception
/*     */   {
/*  99 */     int nResult = 0;
/* 100 */     Long id = Long.valueOf(0L);
/* 101 */     nResult = this.dao.applyUpdates(pData, "id");
/* 102 */     if (nResult > 0) {
/* 103 */       GsonHeadOneRow g = (GsonHeadOneRow)pData.getListInsertRows().get(0);
/* 104 */       id = ObjectComm.objectToLong(g.getValueOfName("id"));
/*     */     } else {
/* 106 */       return Long.valueOf(0L);
/*     */     }
/* 108 */     return id;
/*     */   }
/*     */ 
/*     */   @Transactional(rollbackFor={Exception.class})
/*     */   public int updateUrl(String name, String paths, Long id) throws SQLException {
/* 113 */     String[] head = { name, "id" };
/* 114 */     Object[] data = { paths, id };
/* 115 */     return this.dao.updateJsonOneRow(new GsonHeadOneRow(head, data));
/*     */   }
/*     */ 
/*     */   @Transactional(rollbackFor={Exception.class})
/*     */   public int updateInfor(ParserDataSetJson p) throws SQLException {
/* 120 */     return this.dao.applyUpdates(p);
/*     */   }
/*     */ 
/*     */   @Transactional(rollbackFor={Exception.class})
/*     */   public int delete(Long[] arParams) throws SQLException
/*     */   {
/* 126 */     return this.dao.deleteParams(arParams);
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.keyword.keyWordReply.service.KeyWordReplyService
 * JD-Core Version:    0.5.3
 */